{% extends 'base.html' %}

{% block content %}
<div class="row">
    <div class="col-8">
        <table class="table table-bordered">
            <tr>
                <th scope="row">台网</th>
                <td>
                    {{ station.net.code }}
                </td>
            </tr>
            <tr>
                <th scope="row">台站代码</th>
                <td>
                    {{ station.code }}
                </td>
            </tr>
            <tr>
                <th scope="row">台站名</th>
                <td>
                    {{ station.name }}
                </td>
            </tr>
            <tr>
                <th scope="row">纬度</th>
                <td>
                    {{ station.latitude }}
                </td>
            </tr>
            <tr>
                <th scope="row">经度</th>
                <td>
                    {{ station.longitude }}
                </td>
            </tr>
            <tr>
                <th scope="row">高程</th>
                <td>
                    {{ station.altitude }}
                </td>
            </tr>
            <tr>
                <th scope="row">存储卡容量</th>
                <td>
                    <ul class="list-group list-group-flush">
                        <li class="list-group-item">
                            卡1：{% if station.info.disk1_size %}
                            {{ station.info.disk1_size }} {% else %}
                            <span class="text-muted text-danger">无卡</span> {% endif %}
                        </li>
                        <li class="list-group-item">
                            卡2：{% if station.info.disk2_size %}
                            {{ station.info.disk2_size }} {% else %}
                            <span class="text-muted text-danger">无卡</span>{% endif %}
                        </li>
                    </ul>
                </td>
            </tr>
            <tr>
                <th scope="row">专业仪器列表</th>
                <td>
                    {% if station.info %}
                    <ul class="list-group list-group-flush">
                        {% for instrument in station.info.instruments.all %}
                        {% if instrument.instrument_type.classification == 1 %}
                        <li class="list-group-item">数据采集器：{{ instrument }}</li>
                        {% elif instrument.instrument_type.classification == 2 %}
                        <li class="list-group-item">地震仪：{{ instrument }}</li>
                        {% endif %}
                        {% endfor %}
                    </ul>
                    {% else %}
                    <span class="text-muted text-danger"> 无设备 </span>
                    {% endif %}
                </td>
            </tr>
            <tr>
                <th scope="row">其他设备</th>
                <td>
                    {% if station.other %}
                    <ul class="list-group list-group-flush">
                        {% for other in station.other.all %}
                        <li class="list-group-item">{{ other.content_object }}
                            <span class="badge badge-pill badge-primary">{{ other.quantity }}</span>
                        </li>
                        {% endfor %}
                    </ul>
                    {% else %}
                    <span class="text-muted text-danger"> 无设备 </span>
                    {% endif %}
                </td>
            </tr>
            <tr>
                <th scope="row">建台日期</th>
                <td>{{ station.establish }}</td>
            </tr>
            {% if station.is_end %}
            <tr>
                <th>撤台日期</th>
                <td>{{ station.removal }}</td>
            </tr>
            {% endif %}
            <tr>
                <th scope="row">备注</th>
                <td>{{ station.remark }}</td>
            </tr>
        </table>
        {% if station.has_info %}
        {% if not station.info.instruments.all.exists  %}
        <a href="{% url 'basic:add_current_instruments' station.slug %}">添加当前使用的专业仪器</a> |
        {% endif %}
        {% endif %}
    </div>
</div>
{% endblock %}